package com.tengroup.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tengroup.dao.QuestionTypeDao;
import com.tengroup.entity.QuestionTypeEntity;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tengroup.entity.StudentScoreEntity;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("questiontypeservice")
public class QuestionTypeServicempl extends ServiceImpl<QuestionTypeDao, QuestionTypeEntity> implements QuestionTypeService {
    @Override
    public Integer insert(QuestionTypeEntity questionTypeEntity) {
        return baseMapper.insert(questionTypeEntity);
    }

    @Override
    public Integer update(QuestionTypeEntity questionTypeEntity) {
        return baseMapper.updateById(questionTypeEntity);
    }
    @Override
    public Integer delete(int id) {
        return baseMapper.deleteById(id);
    }
    @Override
    public List<QuestionTypeEntity> getTypeByType(String type){
            LambdaQueryWrapper<QuestionTypeEntity> queryWrapper = Wrappers.lambdaQuery();
            queryWrapper.eq(QuestionTypeEntity::getType, type);
            return baseMapper.selectList(queryWrapper);
    }
}